#ifndef CHATAUDIO_H
#define CHATAUDIO_H

#include <QObject>
#include "audioinfo.h"

class ChatAudio : public QObject
{
    Q_OBJECT
public:
    explicit ChatAudio(QObject *parent = nullptr);
    QByteArray getData();
    void clearData();


signals:
    void inputStateChanged(QAudio::State audioState);
    void outputStateChanged(QAudio::State audioState);

public slots:
    Q_INVOKABLE void inputToggleMode();
    Q_INVOKABLE void outputToggleMode(QString message);

private:
    void initialize(const QAudioDeviceInfo &deviceInfo);

    QScopedPointer<AudioInfo> m_audioInfo;
    QScopedPointer<QAudioInput> m_audioInput;
    QScopedPointer<QAudioOutput> m_audioOutput;
    QByteArray m_data;
    bool m_pullMode = true;
};

#endif // CHATAUDIO_H
